C89 for MSVC which can't be bothered with that newfangled C99...
authorrobertlipe@gmail.com <robertlipe@gmail.com@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sat, 31 Dec 2011 16:15:07 +0000 (16:15 +0000)
committerrobertlipe@gmail.com <robertlipe@gmail.com@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sat, 31 Dec 2011 16:15:07 +0000 (16:15 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4137 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/bend.c
gpsbabel/cet/ansi_x3_4_1968.h
gpsbabel/cet/ibm891.h
gpsbabel/cet/ibm903.h
gpsbabel/cet/iso_8859_1.h
gpsbabel/kml.c
gpsbabel/mmo.c

index 263b7ea80d6399255a0780e737f9babfc8e2e0d7..78610fc56596304b96c0c0c23ae1e0c81f7a9c38 100644 (file)
@@ -76,19 +76,21 @@ create_wpt_dest(const waypoint* wpt_orig, double lat_orig,
 {
   double distance = gcdist(lat_orig, long_orig,
                            lat_orig_adj, long_orig_adj);
+  double frac;
+  double lat_dest;
+  double long_dest;
+  waypoint* wpt_dest = NULL;
   distance = radtometers(distance);
   if (distance <= maxDist) {
     return NULL;
   }
 
-  double frac = maxDist / distance;
-  double lat_dest;
-  double long_dest;
+  frac = maxDist / distance;
 
   linepart(lat_orig, long_orig, lat_orig_adj, long_orig_adj, frac,
            &lat_dest, &long_dest);
 
-  waypoint* wpt_dest = waypt_dupe(wpt_orig);
+  wpt_dest = waypt_dupe(wpt_orig);
   wpt_dest->latitude = DEG(lat_dest);
   wpt_dest->longitude = DEG(long_dest);
 
@@ -136,6 +138,7 @@ process_route(const route_head* route_orig, route_head* route_dest)
 
       double lat_orig_next = RAD(wpt_orig_next->latitude);
       double long_orig_next = RAD(wpt_orig_next->longitude);
+         waypoint* wpt_dest_next = NULL;
 
       if (is_small_angle(lat_orig, long_orig, lat_orig_prev,
                          long_orig_prev, lat_orig_next, long_orig_next)) {
@@ -148,7 +151,7 @@ process_route(const route_head* route_orig, route_head* route_dest)
           route_add_wpt(route_dest, wpt_dest_prev);
         }
 
-        waypoint* wpt_dest_next = create_wpt_dest(wpt_orig,
+        wpt_dest_next = create_wpt_dest(wpt_orig,
                                   lat_orig, long_orig, lat_orig_next, long_orig_next);
         if (wpt_dest_next != NULL) {
           route_add_wpt(route_dest, wpt_dest_next);
index 5ecb94bf12c5a7f9a2250fb3e01ca4bfc642a19c..4f2fa39ecb62fcdc74a933e4424872ac1f7b77f0 100644 (file)
@@ -37,11 +37,11 @@ const char *cet_cs_alias_ansi_x3_4_1968[] =
 #define cet_ucs4_ofs_ansi_x3_4_1968 128
 #define cet_ucs4_cnt_ansi_x3_4_1968 1
 
-const int cet_ucs4_map_ansi_x3_4_1968[cet_ucs4_cnt_ansi_x3_4_1968] = {};
+const int cet_ucs4_map_ansi_x3_4_1968[cet_ucs4_cnt_ansi_x3_4_1968] = {0};
 
 #define cet_ucs4_to_ansi_x3_4_1968_ct 1
 
-const cet_ucs4_link_t cet_ucs4_to_ansi_x3_4_1968_links[cet_ucs4_to_ansi_x3_4_1968_ct] = {};
+const cet_ucs4_link_t cet_ucs4_to_ansi_x3_4_1968_links[cet_ucs4_to_ansi_x3_4_1968_ct] = {0};
 
 // #define cet_ucs4_to_ansi_x3_4_1968_extra_ct 200
 
index 820e0439b853e6257ce89aa23d66942873a3a6c6..85132b4739cf6043018b3c0c6d558d51fff8e96c 100644 (file)
@@ -34,15 +34,15 @@ const char *cet_cs_alias_ibm891[] =
 #define cet_ucs4_ofs_ibm891 128
 #define cet_ucs4_cnt_ibm891 1
 
-const int cet_ucs4_map_ibm891[cet_ucs4_cnt_ibm891] = {};
+const int cet_ucs4_map_ibm891[cet_ucs4_cnt_ibm891] = {0};
 
 #define cet_ucs4_to_ibm891_ct 1
 
-const cet_ucs4_link_t cet_ucs4_to_ibm891_links[cet_ucs4_to_ibm891_ct] = {};
+const cet_ucs4_link_t cet_ucs4_to_ibm891_links[cet_ucs4_to_ibm891_ct] = {0};
 
 /*
 #define cet_ucs4_to_ibm891_extra_ct 0
-const cet_ucs4_link_t cet_ucs4_to_ibm891_extra[cet_ucs4_to_ibm891_extra_ct] = {};
+const cet_ucs4_link_t cet_ucs4_to_ibm891_extra[cet_ucs4_to_ibm891_extra_ct] = {0};
 */
 
 cet_cs_vec_t cet_cs_vec_ibm891 =       /* defined in cet.h */
index c7711cdd867b77757cd0ffe1d19f4c7a5c81a788..eeadd40a92acb2fa94232559ee952a22695520a9 100644 (file)
@@ -34,15 +34,15 @@ const char *cet_cs_alias_ibm903[] =
 #define cet_ucs4_ofs_ibm903 128
 #define cet_ucs4_cnt_ibm903 1
 
-const int cet_ucs4_map_ibm903[cet_ucs4_cnt_ibm903] = {};
+const int cet_ucs4_map_ibm903[cet_ucs4_cnt_ibm903] = {0};
 
 #define cet_ucs4_to_ibm903_ct 1
 
-const cet_ucs4_link_t cet_ucs4_to_ibm903_links[cet_ucs4_to_ibm903_ct] = {};
+const cet_ucs4_link_t cet_ucs4_to_ibm903_links[cet_ucs4_to_ibm903_ct] = {0};
 
 /*
 #define cet_ucs4_to_ibm903_extra_ct 0
-const cet_ucs4_link_t cet_ucs4_to_ibm903_extra[cet_ucs4_to_ibm903_extra_ct] = {};
+const cet_ucs4_link_t cet_ucs4_to_ibm903_extra[cet_ucs4_to_ibm903_extra_ct] = {0};
 */
 
 cet_cs_vec_t cet_cs_vec_ibm903 =       /* defined in cet.h */
index 092b6951388229cd668391e275e38fba7219a2c5..fd2376961ef12dad4e04b23eb89b6f342cec9a2d 100644 (file)
@@ -37,11 +37,11 @@ const char *cet_cs_alias_iso_8859_1[] =
 #define cet_ucs4_ofs_iso_8859_1 256
 #define cet_ucs4_cnt_iso_8859_1 1
 
-const int cet_ucs4_map_iso_8859_1[cet_ucs4_cnt_iso_8859_1] = {};
+const int cet_ucs4_map_iso_8859_1[cet_ucs4_cnt_iso_8859_1] = {0};
 
 #define cet_ucs4_to_iso_8859_1_ct 1
 
-const cet_ucs4_link_t cet_ucs4_to_iso_8859_1_links[cet_ucs4_to_iso_8859_1_ct] = {};
+const cet_ucs4_link_t cet_ucs4_to_iso_8859_1_links[cet_ucs4_to_iso_8859_1_ct] = {0};
 
 /*
 #define cet_ucs4_to_iso_8859_1_extra_ct 0
index 874a7cf677a355ea29dbc1eaebe0f6a2314525c4..ccd023c0953120f4185b757959d464f9f3e4163b 100644 (file)
@@ -1036,7 +1036,7 @@ const char* map_templates[] = {
 static
 void kml_gc_make_balloonstyletext(void)
 {
-
+  const char** tp;
   kml_write_xml(1, "<BalloonStyle><text><![CDATA[\n");
 
   kml_write_xml(0, "<!DOCTYPE html>\n");
@@ -1080,7 +1080,6 @@ void kml_gc_make_balloonstyletext(void)
   kml_gc_all_tabs_text();
   kml_write_xml(0, "<h1>Extra Maps</h1>\n");
 
-  const char** tp;
   kml_write_xml(1, "<ul>\n");
   // Fortunately, all the mappy map URLs take lat/longs in the URLs, so
   // the substition is easy.
@@ -1263,13 +1262,15 @@ char* kml_geocache_get_logs(const waypoint* wpt)
   char* r = xstrdup("");
 
   fs_xml* fs_gpx = (fs_xml*)fs_chain_find(wpt->fs, FS_GPX);
+  xml_tag* root = NULL;
+  xml_tag* curlog = NULL;
+  xml_tag* logpart = NULL;
+
   if (!fs_gpx) {
     return r;
   }
 
-  xml_tag* root = fs_gpx->tag;
-  xml_tag* curlog = NULL;
-  xml_tag* logpart = NULL;
+  root = fs_gpx->tag;
   curlog = xml_findfirst(root, "groundspeak:log");
   while (curlog) {
     time_t logtime = 0;
@@ -1340,6 +1341,9 @@ static void kml_geocache_pr(const waypoint* waypointp)
   char* p, *is;
   char date_placed[100];  // Always long engough for a date.
 
+  const char* issues = "";
+  char* logs;
+
   kml_write_xml(1, "<Placemark>\n");
 
   kml_write_xml(1, "<name>\n");
@@ -1395,7 +1399,6 @@ static void kml_geocache_pr(const waypoint* waypointp)
 
   // Highlight any issues with the cache, such as temp unavail
   // or archived.
-  const char* issues = "";
   if (waypointp->gc_data->is_archived == status_true) {
     issues = "&lt;font color=\"red\"&gt;This cache has been archived.&lt;/font&gt;&lt;br/&gt;\n";
   } else if (waypointp->gc_data->is_available == status_false) {
@@ -1410,7 +1413,7 @@ static void kml_geocache_pr(const waypoint* waypointp)
   kml_write_xml(0, "<Data name=\"gc_icon\"><value>%s</value></Data>\n", is);
   kml_write_xml(0, "<Data name=\"gc_short_desc\"><value><![CDATA[%s]]></value></Data>\n", waypointp->gc_data->desc_short.utfstring ? waypointp->gc_data->desc_short.utfstring : "");
   kml_write_xml(0, "<Data name=\"gc_long_desc\"><value><![CDATA[%s]]></value></Data>\n", waypointp->gc_data->desc_long.utfstring ? waypointp->gc_data->desc_long.utfstring : "");
-  char* logs = kml_geocache_get_logs(waypointp);
+  logs = kml_geocache_get_logs(waypointp);
   kml_write_xml(0, "<Data name=\"gc_logs\"><value><![CDATA[%s]]></value></Data>\n", logs);
   xfree(logs);
 
index 58f9843b467d34c73340719f0f611c8d97f42082..979e3c24cedc785c9c9fa73850567c2af216bc35 100644 (file)
@@ -188,9 +188,9 @@ mmo_readstr(void)
         int ii, jj, ch, resbytes=0;
         res = xmalloc(len*2 + 1); // bigger to allow for utf-8 expansion
         for (ii=0; ii<len; ii++) {
-          ch = gbfgetint16(fin);
           char utf8buf[8];
           int utf8len;
+          ch = gbfgetint16(fin);
           // convert to utf-8, possibly multiple bytes
           utf8len = cet_ucs4_to_utf8(utf8buf, sizeof(utf8buf), ch);
           for (jj=0; jj < utf8len; jj++) {